package com.mall.ware.dao;

import com.mall.common.dao.BaseDao;
import com.mall.ware.entity.WareSkuEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 商品库存
 *
 * @author xjc xjc@163.com
 * @since 1.0.0 2022-07-17
 */
@Mapper
public interface WareSkuDao extends BaseDao<WareSkuEntity> {

    void addStock(@Param("skuId") Long skuId, @Param("wareId") Long wareId, @Param("skuNum") Integer skuNum);

    List<WareSkuEntity> getStock(@Param("skuIds") List<Long> skuIds);

    List<Long> ListWareIdWithStock(@Param("skuId") Long skuId);

    Long lockStock(@Param("skuId") Long skuId, @Param("wareId") Long wareId, @Param("num") Integer num);

    Long unLockStock(@Param("skuId") Long skuId, @Param("wareId") Long wareId, @Param("skuNum") Integer skuNum);

    Long reduceStock(@Param("wareId") Long wareId, @Param("skuId") Long skuId, @Param("skuNum") Integer skuNum);
}